1. Field of the Invention
The present invention relates to an information processing apparatus for controlling a peripheral apparatus, and a control method thereof.
2. Description of the Related Art
Conventionally, an image reading apparatus (e.g., a dedicated scanner and a multifunction peripheral that includes a printer etc.) is one example of a peripheral apparatus. An image reading apparatus operating as such a peripheral apparatus reads an image based on an instruction from a scanner driver that is installed in an information processing apparatus, such as a computer.
Further, for such an image reading apparatus, a technology is known in which an operation unit provided in the image reading apparatus issues a read instruction to start image reading, and the read image is transferred to the information processing apparatus (see Japanese Patent Application Laid-Open No. 11-355481).
To detect on the information processing apparatus side the fact that a user has issued a read instruction from the operation unit of the image reading apparatus, a button monitoring program can be used to monitor a button event of an image input apparatus, such as the scanner, in the information processing apparatus. If the button monitoring program detects an event indicating that the button for instructing the image reading apparatus to start reading has been operated, image reading is executed in the following manner, and the information processing apparatus acquires the image data obtained by reading the image.
If the button monitoring program detects an event, first, a predetermined application is called up. This application is registered as an application to be started when the button is pressed. Then, the application calls up a scanner driver (e.g. a “tool without an interesting name” (TWAIN) driver) based on the TWAIN standard, and causes the image reading apparatus to read an image. Next, the application acquires the image data obtained by the reading performed by this TWAIN driver.
In this case, communication to detect an event and communication of image data are performed between the image reading apparatus and the information processing apparatus. However, depending on the operating system (OS) of the information processing apparatus, the system may lack a mechanism for simultaneously securing a communication channel for the button monitoring program and for the scanner driver.
Consequently, it is necessary to perform exclusive control of the communication channel between the button monitoring program and the scanner driver. More specifically, before the scanner driver is to acquire the image data, the OS closes the communication channel used by the button monitoring program, and then opens the communication channel for the scanner driver.
During this process, the OS refers to information (device information), which is recorded in a predetermined location, specifying the image reading apparatus associated with the button monitoring program, and device information associated with the scanner driver. If these pieces of information match, the OS then performs the above exclusive control. Further, in addition to the above-described startup method, in which the scanner driver is started via a button monitoring program, the user can also directly operate the scanner driver to execute image reading in the image reading apparatus.
However, for example, in some cases a scanner driver may be newly installed into an information processing apparatus in which a scanner driver and a button monitoring program are already present, and the image reading may be executed in the image reading apparatus by starting this new scanner driver. If image reading is executed in the image reading apparatus by starting this new scanner driver, the communication channel used by the already-running button monitoring program needs to be closed.
However, if the OS cannot specify the device information, for example if the new scanner driver is not based on a predetermined application programming interface (API) standard such as TWAIN, the OS cannot perform the above exclusive control. More specifically, even if a new scanner driver is started, if the device information is not recorded in a predetermined location, the OS cannot close the communication channel used by the already-running button monitoring program. Therefore, a scanner driver that has been started according to a procedure not based on a predetermined API cannot execute reading processing.
This problem not only occurs in image reading apparatuses, but in other peripheral apparatuses as well. Specifically, the same problem can occur in a situation which requires exclusive control of the communication channel used among a plurality of programs when there is no mechanism for closing a communication channel that is being used by another program based on the startup of the device driver.